package jircbot.irc;

/**
 *
 * @author matt
 */
public class IrcUser {
	private String nick;
	private String host;
	private String ip;
	
	IrcUser(String rawUser)
	{
		setNick(rawUser.substring(1, rawUser.indexOf("!")));
		setHost(rawUser.substring(rawUser.indexOf("!")+1,rawUser.indexOf("@")));
		setIp(rawUser.substring(rawUser.indexOf("@")+1, rawUser.length()));
	}

	IrcUser(String nick, String host, String ip)
	{
		setNick(nick);
		setHost(host);
		setIp(ip);
	}

	/**
	 * Retrieves the IRC nick name of the user.
	 *
	 * @return the IRC nick
	 */
	public String getNick()
	{
		return nick;
	}

	/**
	 * Retrieves the host of the user
	 * 
	 * @return The host
	 */
	public String getHost()
	{
		return host;
	}

	/**
	 * Gets the ip of the user.
	 *
	 * @return The ip
	 */
	public String getIp()
	{
		return ip;
	}

	private void setNick(String nick)
	{
		this.nick = nick;
	}

	private void setHost(String host)
	{
		this.host = host;
	}

	private void setIp(String ip)
	{
		this.ip = ip;
	}
}
